﻿/*
   Open Intel 
   Copyright © 2011 – ISC. All Rights Reserved.
*/
using System;
using Caliburn.Micro;

namespace OI.Async
{
    public class MDNMapTileLayerSetupComplete : IResult
    {
        readonly ISC.RIM.Silverlight.Map RIMMap;
        public event EventHandler<ResultCompletionEventArgs> Completed;


        public MDNMapTileLayerSetupComplete(ISC.RIM.Silverlight.Map map)
        {
            RIMMap = map;
            map.TileLayerSetupComplete += MapTileLayerSetupComplete;
        }


        void MapTileLayerSetupComplete(object sender, EventArgs e)
        {
            Completed(this, new ResultCompletionEventArgs());
        }


        public void Execute(ActionExecutionContext context)
        {
            if (RIMMap.IsTileLayerSetupCompleted)
            {
                Completed(this, new ResultCompletionEventArgs());
            }
        }
    }
}
